I am using php and smarty, what i have to do is i have a drop down box with dynamic name, id and values.
like
Expand|Select|Wrap|Line Numbers
- <select name="id[{$options_data.ID}]" id="id[{$options_data.ID}]" onchange="sample()" >
- {foreach key=key_data item=item_data from=$options_data.DATA}
- <option value="{$item_data.ID}">{$item_data.TEXT} {if $item_data.PRICE !='' }{$item_data.PREFIX} {$item_data.PRICE}{/if} </option>
- {/foreach}
- </select>
Ex :
Expand|Select|Wrap|Line Numbers
- <select name ="id[{$options_data.ID}]" id="id[{$options_data.ID}]" onchange="sample()>
- <option value="45">value 1</option>
- <option value ="46">value 2</option>
- </select>
Javascript code on top of the html page:
Expand|Select|Wrap|Line Numbers
- <script language="javascript">
- function sample()
- {
- var id = document.getElementById("id[3]");
- alert("The content of the first " + "\"" + id.innerHTML + "\".");
- }
- </script>
can anyone help me what will be the correction in this please.
regards
magesh